/**
 *  @file
 *  @brief   2x2x2六面体实体结构
 *  @author  lijiayang
 *  @date    2024.05.10
 *  @version  v1.0
 *  @par Copyright(c):  ShenGong  Simulation corporation
 */

#pragma once
#include "DataStructure/Input/Element/CHEXAData.h"

#include "DBManager/DBServiceFactory.h"
#include "DBManager/Database/DatabaseFactory.h"
#include "DBManager/IService/Input/Element/IElementService.h"
#include "DBManager/IService/Input/Property/IPSOLIDService.h"

using SG::DataStructure::FEM::DOFDirections;
using namespace SG::DBManager;
extern std::shared_ptr<DBServiceFactory> DB_SERVICEFACTORY;
/// 8节点6面体实体单元
class Cube_2x2x2Hexa8Ele
{
  public:
    Cube_2x2x2Hexa8Ele ()
    {
        DB_SERVICEFACTORY->ClearDatabase ();
        Input (DB_SERVICEFACTORY);
    }

    /// @brief 写入模型数据
    void               Input (const DBServiceFactorySP dbServiceFactory);
    DBServiceFactorySP GetModel ()
    {
        return DB_SERVICEFACTORY;
    }
};

void Cube_2x2x2Hexa8Ele::Input (const DBServiceFactorySP dbServiceFactory)
{
    // 节点写入
    SG::DataStructure::FEM::NodeData node;
    node.m_id = 1;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 2;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 3;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 4;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 5;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 6;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 7;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 8;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 9;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 10;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 11;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 12;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 13;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 14;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 15;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 16;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 17;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 18;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 19;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 20;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 21;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 22;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 23;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 24;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 25;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 26;
    dbServiceFactory->get<INodeService> ()->Add (node);
    node.m_id = 27;
    dbServiceFactory->get<INodeService> ()->Add (node);
    // 截面属性写入
    // 写入单元i kmoooo  ii  ikikk
    {
        SG::DataStructure::FEM::CHEXA8Data ElementData;
        ElementData.m_id  = 1;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 1, 2, 4, 5, 10, 11, 13, 14 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 2;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 2, 3, 5, 6, 11, 12, 14, 15 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 3;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 4, 5, 7, 8, 13, 14, 16, 17 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 4;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 5, 6, 8, 9, 14, 15, 17, 18 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 5;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 10, 11, 13, 14, 19, 20, 22, 23 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 6;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 11, 12, 14, 15, 20, 21, 23, 24 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 7;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 13, 14, 16, 17, 22, 23, 25, 26 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
        ElementData.m_id  = 8;
        ElementData.m_pId = 1;
        ElementData.Set8Points ({ 14, 15, 17, 18, 23, 24, 26, 27 });
        dbServiceFactory->get<IElementService> ()->Add (ElementData);
    }
    // 节点固定约束
}